package com.heima.feigns;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.heima.config.HeimaFeignAutoConfiguration;
import com.heima.feigns.fallback.WemediaFeignFallback;
import com.heima.model.common.dtos.ResponseResult;
import com.heima.model.wemedia.pojos.WmNews;
import com.heima.model.wemedia.pojos.WmUser;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;

//feign客户端注解：服务的对象，服务降级打印详细日志，配置类
@FeignClient(value = "leadnews-wemedia",fallbackFactory =WemediaFeignFallback.class ,
        configuration =HeimaFeignAutoConfiguration.class )
public interface WemediaFeign {
    @GetMapping("/api/v1/news/one/{id}")
    ResponseResult<WmNews> findById(@PathVariable("id") Integer id);

    @PutMapping("/api/v1/news/update")
    ResponseResult updateWmNews(@RequestBody WmNews wmNews);

    @GetMapping("/api/v1/user/findOne/{id}")
    ResponseResult<WmUser> findWmUserById(@PathVariable("id") Integer id);

    @PostMapping("/api/v1/user/save")
    public ResponseResult<WmUser> save(@RequestBody WmUser wmUser);

    @GetMapping("/api/v1/user/findByName/{name}")
    public ResponseResult<WmUser> findByName(@PathVariable("name") String name);

    @GetMapping("/api/v1/news/findRelease")
    ResponseResult<List<Integer>> findRelease();
}
